package com.yxhl.zoume.data.http.model.passenger;

import com.google.gson.annotations.SerializedName;
import com.yxhl.zoume.data.http.model.base.BaseModel;

import java.io.Serializable;

/**
 * Created by Xboy on 16/3/15.
 */
public class ZMPassenger extends BaseModel {

    /**
     * 成人
     */
    public static final int ADULT = 1;
    /**
     * 儿童
     */
    public static final int CHILD = 2;
    /**
     * 用户订单：选择出行乘客
     */
    private boolean isSelected;
    // 乘客ID
    @SerializedName("id")
    private String passengerId;
    // 乘客性别
    @SerializedName("gender")
    private int gender;
    // 乘客姓名
    @SerializedName("realname")
    private String realName;
    // 乘客证件类型
    @SerializedName("idType")
    private int idType;
    // 乘客证件号码
    @SerializedName("idNumber")
    private String idNumber;
    // 乘客类型：成人 or 儿童
    @SerializedName("contractType")
    private int psgerCategory;
    // 乘客手机号
    @SerializedName("mobile")
    private String mobileNumber;

    public ZMPassenger() {
    }

    public ZMPassenger(String realName,
                       String idNumber,
                       int psgerCategory,
                       String mobileNumber) {
        this.realName = realName;
        this.idNumber = idNumber;
        this.psgerCategory = psgerCategory;
        this.mobileNumber = mobileNumber;
    }

    public boolean isSelected() {
        return isSelected;
    }

    public ZMPassenger setSelected(boolean selected) {
        isSelected = selected;
        return this;
    }

    public String getPassengerId() {
        return passengerId;
    }

    public ZMPassenger setPassengerId(String passengerId) {
        this.passengerId = passengerId;
        return this;
    }

    public int getGender() {
        return gender;
    }

    public void setGender(int gender) {
        this.gender = gender;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public int getIdType() {
        return idType;
    }

    public void setIdType(int idType) {
        this.idType = idType;
    }

    public String getIdNumber() {
        return idNumber;
    }

    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }

    public int getPsgerCategory() {
        return psgerCategory;
    }

    public ZMPassenger setPsgerCategory(int psgerCategory) {
        this.psgerCategory = psgerCategory;
        return this;
    }

    public String getMobileNumber() {
        return mobileNumber;
    }

    public void setMobileNumber(String mobileNumber) {
        this.mobileNumber = mobileNumber;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ZMPassenger)) return false;

        ZMPassenger passenger = (ZMPassenger) o;

        return getPassengerId().equals(passenger.getPassengerId())
                || getRealName().equals(passenger.getRealName());

    }

    @Override
    public String toString() {
        return "ZMPassenger{" +
                "passengerId=" + passengerId +
                ", gender=" + gender +
                ", realName='" + realName + '\'' +
                ", idType=" + idType +
                ", idNumber='" + idNumber + '\'' +
                ", psgerCategory=" + psgerCategory +
                ", mobileNumber='" + mobileNumber + '\'' +
                '}';
    }


    /**
     * 乘客类型：成人1，儿童2
     */
    public enum PassengerCategory implements Serializable {

        ADULT(1, "成人"), CHILD(2, "儿童");

        //设置可序列化编号
        public static final long serialVersionUID = 12L;
        private int categoryType;
        private String categoryName;

        PassengerCategory(int categoryType, String categoryName) {
            this.categoryType = categoryType;
            this.categoryName = categoryName;
        }

        public int getCategoryType() {
            return categoryType;
        }

        public String getCategoryName() {
            return categoryName;
        }
    }
}
